package com.sun.hunk.hibernate.dao;

import com.sun.hunk.hibernate.BaseHibernateDAO;
import com.sun.hunk.hibernate.domain.Item;
import com.sun.hunk.hibernate.domain.impl.ItemImpl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author sunil
 */
public class ItemDAO extends BaseHibernateDAO<ItemImpl> {

    public ItemDAO() {
        super(ItemImpl.class);
    }

    public List<Item> getItemsForCategory(Long categoryId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("categarory.id", categoryId);
        return find(map);
    }

    public Item getById(Long categoryId) {
        return findById(categoryId);
    }
    public Item getByCode(String code) {
        return getByProperty("code", code);
    }
}
